home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / time / clocktest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-18  |  269 b   |  17 lines

  1. #include <stdio.h>
  2. #include <time.h>
  3.  
  4. main ()
  5. {
  6.   volatile int i;
  7.   double t1, t2, t;
  8.  
  9.   t1 = (double) clock ();
  10.   for (i = 0; i < 100000; ++i) ;
  11.   t2 = (double) clock ();
  12.  
  13.   t = (t2 - t1) / ((double) CLOCKS_PER_SEC);
  14.   printf ("%f - %f = %f\n",t2,t1,t);
  15.   return 0;
  16. }
  17.